<?php
//王晓梦
declare (strict_types=1);

namespace app\backend\validate;

use think\Validate;

class PurchaseValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id' => 'require',
        'cate_id' => 'require',
        'name' => 'require',
        'number' => 'require',
        'address' => 'require',
        'publisher' => 'require',
        'certification' => 'require',
        'guige' => 'require',
        'region' => 'require',
        'join' => 'require',
        'image' => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require' => 'id不能为空',
        'cate_id.require' => '请输入所属分类',
        'name.require' => '请输入采购品种',
        'number.require' => '请输入采购数量',
        'address.require' => '请输入期待货源地',
        'publisher.require' => '请输入发布人',
        'certification.require' => '请输入认证情况',
        'guige.require' => '请输入规格品质',
        'region.require' => '请输入收货地',
        'join.require' => '请输入加入农副网时间',
        'image.require' => '请上传头像',

    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'save' => ['cate_id', 'image','name','number', 'address','publisher','certification','guige','region','join'],
        'update' => ['id','cate_id', 'image','name','number', 'address','publisher','certification','guige','region','join']
    ];
}
